package com.Jano.mapper;

import com.Jano.entity.Reply;
import org.apache.ibatis.annotations.*;
import org.springframework.data.relational.core.sql.In;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * description: ReplyMapper <br>
 * date: 2022/7/12 2:33 PM <br>
 * author: zoumaoji <br>
 * version: 1.0 <br>
 */
@Mapper
public interface ReplyMapper {
    /**
     * 根据论贴id查询评论
     * @param invitationId
     * @return
     */
    @Select("select id,invid,content,author,createdate createDate from reply_detail  where invid = #{invitationId} order by createdate desc")
    List<Reply> selectReplyByInvitationId(Integer invitationId);

    /**
     *增加评论
     * @param invitationId
     * @param content
     * @param author
     * @param createDate
     * @return
     */
    @Insert("insert into reply_detail(invid,content,author,createdate) values(#{invitationId},#{content},#{author},#{createDate})")
    Boolean InsertReply(Integer invitationId, String content, String author,  Date createDate);


    /**
     * 删除评论
     * @param invitationId
     * @return
     */
    @Delete("delete from reply_detail where invid=#{invitationId}")
    Boolean deleteReply(Integer invitationId);
}
